<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Deletes the large object</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="pdo.pgsqllobopen.html">« PDO::pgsqlLOBOpen</a></li>
      <li style="float: right;"><a href="ref.pdo-sqlite.html">SQLite (PDO) »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.pdo-pgsql.html">PostgreSQL (PDO)</a></li>
    <li>Deletes the large object</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="pdo.pgsqllobunlink" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">PDO::pgsqlLOBUnlink</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PHP 8, PECL pdo_pgsql &gt;= 1.0.2)</p><p class="refpurpose"><span class="refname">PDO::pgsqlLOBUnlink</span> &mdash; <span class="dc-title">Deletes the large object</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-pdo.pgsqllobunlink-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>PDO::pgsqlLOBUnlink</strong></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$oid</code></span>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   Deletes a large object from the database identified by OID.
  </p>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    This function must be called within a transaction.
   </span>
  </p></blockquote>

 </div>

 <div class="refsect1 parameters" id="refsect1-pdo.pgsqllobunlink-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">oid</code></dt>

     <dd>

      <p class="para">
       A large object identifier
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-pdo.pgsqllobunlink-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-pdo.pgsqllobunlink-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-1109">
    <p><strong>示例 #1 A <span class="function"><strong>PDO::pgsqlLOBUnlink()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     This example unlinks a large object from the database prior to deleting
     the row that references it from the blobs table we&#039;ve been using in
     our <span class="function"><a href="pdo.pgsqllobcreate.html" class="function">PDO::pgsqlLOBCreate()</a></span> and
     <span class="function"><a href="pdo.pgsqllobopen.html" class="function">PDO::pgsqlLOBOpen()</a></span> examples.
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$db&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">(</span><span style="color: #DD0000">'pgsql:dbname=test&nbsp;host=localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$user</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$pass</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setAttribute</span><span style="color: #007700">(</span><span style="color: #0000BB">PDO</span><span style="color: #007700">::</span><span style="color: #0000BB">ATTR_ERRMODE</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">PDO</span><span style="color: #007700">::</span><span style="color: #0000BB">ERRMODE_EXCEPTION</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">beginTransaction</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">pgsqlLOBUnlink</span><span style="color: #007700">(</span><span style="color: #0000BB">$oid</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">prepare</span><span style="color: #007700">(</span><span style="color: #DD0000">"DELETE&nbsp;FROM&nbsp;BLOBS&nbsp;where&nbsp;ident&nbsp;=&nbsp;?"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$stmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">execute</span><span style="color: #007700">(array(</span><span style="color: #0000BB">$some_id</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$db</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">commit</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-pdo.pgsqllobunlink-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="pdo.pgsqllobopen.html" class="function" rel="rdfs-seeAlso">PDO::pgsqlLOBOpen()</a> - Opens an existing large object stream</span></li>
    <li class="member"><span class="function"><a href="pdo.pgsqllobcreate.html" class="function" rel="rdfs-seeAlso">PDO::pgsqlLOBCreate()</a> - Creates a new large object</span></li>
   </ul>
  </p>
 </div>



</div></div></div></body></html>